package com.atguigu.gulimall.member.controller;

import com.atguigu.common.utils.R;
import com.atguigu.gulimall.member.feign.OrderFeignService;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

@Controller
public class MemberWebController {
    @Autowired
    private OrderFeignService orderFeignService;

    @SneakyThrows
    @GetMapping("/memberOrder.html")
    public String memberOrderPage(@RequestParam("map") Map<String,Object> map, Model model, HttpServletRequest request) throws UnsupportedEncodingException {

        R r = orderFeignService.listWithItem(map);
        model.addAttribute("orderList",r);
        return "orderList";
    }
}
